package com.hc.util;

import java.util.HashMap;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.widget.TextView;

public abstract class BatteryBroadcastReceiver extends BroadcastReceiver {

	private Context context;
	private IntentFilter batteryLevelFilter;
	public int rawlevel;
	public int scale;
	public int health;
	public int status;

	public BatteryBroadcastReceiver(Context context) {
		this.context = context;
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		rawlevel = intent.getIntExtra("level", -1);
		scale = intent.getIntExtra("scale", -1);
		status = intent.getIntExtra("status", -1);
		health = intent.getIntExtra("health", -1);
		getInfo();
	}
	
	public  abstract void getInfo();

	public String getAllInfo() {
		String info = "" + "-level:" + rawlevel + "--scale:" + scale
				+ "-health:" + health;
		return info;
	}

	 public void registerReceiver() {
	 batteryLevelFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
	 context.registerReceiver(this, batteryLevelFilter);
	 }
	//
	// public void unregisterRecevier() {
	// //context.unregisterReceiver(this);
	// }
	//
	//
	//

}
